from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE `good_attr` (
    `attribute_id` INT NOT NULL REFERENCES `attr` (`id`) ON DELETE CASCADE,
    `good_id` INT NOT NULL REFERENCES `good` (`id`) ON DELETE CASCADE
) CHARACTER SET utf8mb4 COMMENT='动态属性值';"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        DROP TABLE IF EXISTS `good_attr`;"""
